﻿<!--BitAdmin2.0框架文件-->
<div class="box">
    <div id="FlowMainQuery" class="box-body querySuite-wrapper">
        <!-- 条件搜索 -->
        <div class="querySuite-filter">
            <table>
                <tr>
                    <th>流程名称:</th>
                    <td><input type="text" name="Name" class="form-control" placeholder="请输入流程名称"></td>
                    <th>流程编号：</th>
                    <td><input type="text" name="Code" class="form-control" placeholder="请输入流程编号"></td>
                </tr>
            </table>
        </div>
        <!-- 按钮 查询 导入 -->
        <div class="querySuite-button">
            <button class="btn btn-default" action="query">
                <span class="glyphicon glyphicon-search"></span> 查询
            </button>
            <button class="btn btn-default" action="add" action-modal="MainFlowModal">
                <span class="glyphicon glyphicon-plus-sign"></span> 添加
            </button>
            <button class="btn btn-danger" action="delete">
                <span class="glyphicon glyphicon-trash"></span> 删除
            </button>
        </div>
        <!-- 列表-->
        <div class="querySuite-table" data-order-by="Code" data-order-type="ASC"
             data-key="id"
             data-query-url="../../workflow/QueryFlowMainData"
             data-delete-url="../../workflow/DeleteFlowMainData">
            <table>
                <thead>
                    <tr>
                        <th style="width: 30px;"><input type="checkbox" /></th>
                        <th data-field="name" data-format="edit">流程名</th>
                        <th data-field="code">流程编号</th>
                        <th data-field="description">描述</th>
                        <th data-field="option">操作</th>
                    </tr>
                </thead>
            </table>
        </div>
        <!-- 分页 -->
        <div class="querySuite-paging" data-page-size="10"></div>
    </div>
</div>
<!-- 模态框（Modal）编辑"示例信息" -->
<div id="MainFlowModal" class="modal fade formSuite-wrapper" role="dialog" aria-hidden="true">
    <div class="modal-dialog" style="width: 500px;">
        <div class="modal-content">
            <div class="modal-body">
                <form data-title="流程信息"
                      data-save-url="../../workflow/SaveFlowMainData"
                      data-load-url="../../workflow/LoadFlowMainData">
                    <input type="hidden" name="id" />
                    <table>
                        <tr>
                            <th>流程名：</th>
                            <td>
                                <input name="name" type="text" class="form-control required" placeholder="请输入流程名" />
                            </td>
                        </tr>
                        <tr>
                            <th>流程编号：</th>
                            <td>
                                <input name="code" type="text" class="form-control required" placeholder="请输入流程编号">
                            </td>
                        </tr>
                        <tr>
                            <th>描述：</th>
                            <td>
                                <textarea name="description" class="form-control" placeholder="请输入描述" rows="10"></textarea>
                            </td>
                        </tr>
                    </table>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary" action="save">
                    <span class="glyphicon glyphicon-saved"></span>保存
                </button>
                <button type="button" class="btn btn-default" data-dismiss="modal">
                    <span class="glyphicon glyphicon-remove"></span>关闭
                </button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>

<script src="../../js/lib/jquery.jedate.js"></script>
<script type="text/javascript">
    $(function () {
        //查询套件初始化
        var querySuite = $("#FlowMainQuery").querySuite()
            .columns["option"].format(function (event, val, data) {
                $(this).append($('<span class="btn btn-link">配置流程</span>')
                    .bind('click', function () {
                        window.open("../system/flowdesign.html?fm=" + data.id, 'flowdesign', 'height=' + (window.screen.availHeight - 70) + 'px,width=' + (window.screen.availWidth - 15) + 'px,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=yes, status=no');
                    }));
            })
            .query();

        //表单套件初始化
        var formSuite = $("#MainFlowModal").formSuite()
            .add(function () {//点击添加：初始化表单后
            })
            .edit(function (result) {//点击编辑：加载数据后
            })
            .submit(function (result) {//点击保存：数据保存成功后
                querySuite.query();
            });
    });

</script>